Re-realize the window if needed
authorMatthias Clasen <mclasen@redhat.com>
Fri, 24 Jan 2014 19:32:00 +0000 (14:32 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 4 Feb 2014 03:22:27 +0000 (22:22 -0500)
When gtk_window_set_titlebar is called, we need to set up
client-side decorations properly, and the easiest way to do
so is to realize the window again. Really, you should call
set_titlebar before the window is realized.

https://bugzilla.gnome.org/show_bug.cgi?id=722919

gtk/gtkwindow.c

index 132617ae441744c15660545612b60699e0487792..3605f5a64a81d6e801251a83055976c4e153e7bc 100644 (file)
@@ -3682,9 +3682,14 @@ gtk_window_set_titlebar (GtkWindow *window,
   GtkWidget *widget = GTK_WIDGET (window);
   GtkWindowPrivate *priv = window->priv;
   GdkVisual *visual;
+  gboolean was_mapped;
 
   g_return_if_fail (GTK_IS_WINDOW (window));
 
+  was_mapped = gtk_widget_get_mapped (widget);
+  if (gtk_widget_get_realized (widget))
+    gtk_widget_unrealize (widget);
+
   unset_titlebar (window);
 
   if (titlebar == NULL)
@@ -3715,7 +3720,8 @@ gtk_window_set_titlebar (GtkWindow *window,
   gtk_style_context_add_class (gtk_widget_get_style_context (titlebar),
                                GTK_STYLE_CLASS_TITLEBAR);
 
-  gtk_widget_queue_resize (widget);
+  if (was_mapped)
+    gtk_widget_map (widget);
 }
 
 gboolean